﻿<Window x:Class="_8.RectangleMove.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="350" Width="525">
    <Canvas>
        <Rectangle x:Name="RectangleBlue" Width="200" Height="100" Fill="Blue"
                   Canvas.Top="100" Canvas.Left="250">
            <Rectangle.RenderTransform>
                <RotateTransform Angle="180" CenterX="50" CenterY="10"></RotateTransform>
            </Rectangle.RenderTransform>
            <Rectangle.Triggers>
                <EventTrigger RoutedEvent="Rectangle.Loaded">
                    <BeginStoryboard>
                        <Storyboard>
                            <DoubleAnimation 
                                Storyboard.TargetName="RectangleBlue"
                                Storyboard.TargetProperty="(Canvas.Left)"
                                From="0" To="325" Duration="00:00:0.97"
                                AutoReverse="True" RepeatBehavior="Forever"></DoubleAnimation>
                            <DoubleAnimation
                                Storyboard.TargetName="RectangleBlue"
                                Storyboard.TargetProperty="(RenderTransform).(RotateTransform.Angle)"
                                From="360" To="0"
                                AutoReverse="False" RepeatBehavior="Forever"></DoubleAnimation>
                            <ColorAnimation
                                Storyboard.TargetName="RectangleBlue"
                                Storyboard.TargetProperty="Fill.Color"
                                From="Blue" To="Yellow" Duration="00:00:0.6"
                                AutoReverse="True" RepeatBehavior="Forever" />
                        </Storyboard>
                    </BeginStoryboard>
                </EventTrigger>
            </Rectangle.Triggers>
        </Rectangle>
    </Canvas>
</Window>
